package ui.tests;



import org.omg.Dynamic.Parameter;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import rozetka.Main;

import java.util.Arrays;

public class Basic {
    @Parameters (value="expectedIterations")
    @DataProvider
    public Object[][] inputDataTypes() {
            return new Object[][] {
             //   new Object[] {"./src/main/resources/t1Indata.csv"},
             //   new Object[] {"./src/main/resources/t1Indata.xml"},
             //   new Object[] {"./src/main/resources/t1Indata.xls"},
                new Object[] {new int[]{3,2,1}, new int[]{1,2,3}},
                new Object[] {new int[]{6,2,3}, new int[]{2,3,6}},
                new Object[] {new int[]{10,2,3,8,0}, new int[]{0,2,3,8,10}}
        };
    }
  /*  @Test(dataProvider = "inputDataTypes")


    public void binarySearchTest(int[] testArray, int testValue, int expectedIterations){

      // int[] testArray ={1,2,3};
      // int testValue =2;
      // int expectedIterations =1;

       Arrays.sort(testArray);
       // Main.binarySearch (testArray, testValue);
        Assert.assertEquals(expectedIterations, Main.binarySearch(testValue, testArray ));

    }
*/

    @Test
    public void sortTest(){
        int[] myArr = {1,0,8,100,2,3,4,5};

        int[] newArr = Main.sortirovka(myArr);
        Arrays.sort(myArr);
        Assert.assertEquals(myArr, newArr);
    }

    @Test(dataProvider = "inputDataTypes")
    public void sortirovkaTest(int[] firstArr, int[] secondArr){
        int[] newArr = Main.sortirovka(firstArr);

        Assert.assertEquals(newArr, secondArr);
    }


}
